package com.wanxi.springboot.team.manage.system.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitConfig {

    public static final String  QUEUE_A = "noRoleUser";//队列名
    public static final String  ROUTING_KEY_A = "noRoleUser";//队列路径
    public static final String  TOPIC_EXCHANGE_NAME_A = "com.wanxi.topic";//交换机名

    @Bean
    public Queue noRoleUser(){
        return new Queue(QUEUE_A,true);
    }
    @Bean
    TopicExchange topicExchange(){
        return new TopicExchange(TOPIC_EXCHANGE_NAME_A,true,false);
    }

    @Bean
    Binding noRoleUserTopicExchange(){
        return BindingBuilder.bind(noRoleUser()).to(topicExchange()).with(ROUTING_KEY_A);
    }
}
